#include "Type.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Type_classType = NULL;
VTable* Type_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Str toStr() */
Str* Type_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.toStr not implemented yet"));
}


/* Type of(Obj obj) */
Type* Type_of(Obj obj)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.of not implemented yet"));
}


/* Type? find(Str qname, Bool checked) */
Type* Type_find_1(Str* qname)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.find not implemented yet"));
}


/* Type? find(Str qname, Bool checked) */
Type* Type_find(Str* qname, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.find not implemented yet"));
}


/* Pod? pod() */
Pod* Type_pod(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.pod not implemented yet"));
}


/* Str name() */
Str* Type_name(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.name not implemented yet"));
}


/* Str qname() */
Str* Type_qname(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.qname not implemented yet"));
}


/* Str signature() */
Str* Type_signature(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.signature not implemented yet"));
}


/* Type? base() */
Type* Type_base(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.base not implemented yet"));
}


/* Type[] mixins() */
List* Type_mixins(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.mixins not implemented yet"));
}


/* Type[] inheritance() */
List* Type_inheritance(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.inheritance not implemented yet"));
}


/* Bool fits(Type t) */
Bool Type_fits(Type* self, Type* t)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.fits not implemented yet"));
}


/* Bool isVal() */
Bool Type_isVal(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isVal not implemented yet"));
}


/* Bool isNullable() */
Bool Type_isNullable(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isNullable not implemented yet"));
}


/* Type toNullable() */
Type* Type_toNullable(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.toNullable not implemented yet"));
}


/* Type toNonNullable() */
Type* Type_toNonNullable(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.toNonNullable not implemented yet"));
}


/* Bool isGeneric() */
Bool Type_isGeneric(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isGeneric not implemented yet"));
}


/* [Str:Type] params() */
Map* Type_params(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.params not implemented yet"));
}


/* Type parameterize([Str:Type] params) */
Type* Type_parameterize(Type* self, Map* params)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.parameterize not implemented yet"));
}


/* Type toListOf() */
Type* Type_toListOf(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.toListOf not implemented yet"));
}


/* Obj[] emptyList() */
List* Type_emptyList(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.emptyList not implemented yet"));
}


/* Bool isAbstract() */
Bool Type_isAbstract(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isAbstract not implemented yet"));
}


/* Bool isClass() */
Bool Type_isClass(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isClass not implemented yet"));
}


/* Bool isConst() */
Bool Type_isConst(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isConst not implemented yet"));
}


/* Bool isEnum() */
Bool Type_isEnum(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isEnum not implemented yet"));
}


/* Bool isFacet() */
Bool Type_isFacet(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isFacet not implemented yet"));
}


/* Bool isFinal() */
Bool Type_isFinal(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isFinal not implemented yet"));
}


/* Bool isInternal() */
Bool Type_isInternal(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isInternal not implemented yet"));
}


/* Bool isMixin() */
Bool Type_isMixin(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isMixin not implemented yet"));
}


/* Bool isPublic() */
Bool Type_isPublic(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isPublic not implemented yet"));
}


/* Bool isSynthetic() */
Bool Type_isSynthetic(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.isSynthetic not implemented yet"));
}


/* Field[] fields() */
List* Type_fields(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.fields not implemented yet"));
}


/* Method[] methods() */
List* Type_methods(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.methods not implemented yet"));
}


/* Slot[] slots() */
List* Type_slots(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.slots not implemented yet"));
}


/* Field? field(Str name, Bool checked) */
Field* Type_field_1(Type* self, Str* name)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.field not implemented yet"));
}


/* Field? field(Str name, Bool checked) */
Field* Type_field(Type* self, Str* name, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.field not implemented yet"));
}


/* Method? method(Str name, Bool checked) */
Method* Type_method_1(Type* self, Str* name)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.method not implemented yet"));
}


/* Method? method(Str name, Bool checked) */
Method* Type_method(Type* self, Str* name, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.method not implemented yet"));
}


/* Slot? slot(Str name, Bool checked) */
Slot* Type_slot_1(Type* self, Str* name)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.slot not implemented yet"));
}


/* Slot? slot(Str name, Bool checked) */
Slot* Type_slot(Type* self, Str* name, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.slot not implemented yet"));
}


/* Obj make(Obj[]? args) */
Obj Type_make_0(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.make not implemented yet"));
}


/* Obj make(Obj[]? args) */
Obj Type_make(Type* self, List* args)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.make not implemented yet"));
}


/* Facet[] facets() */
List* Type_facets(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.facets not implemented yet"));
}


/* Facet? facet(Type type, Bool checked) */
Facet* Type_facet_1(Type* self, Type* type)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.facet not implemented yet"));
}


/* Facet? facet(Type type, Bool checked) */
Facet* Type_facet(Type* self, Type* type, Bool checked)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.facet not implemented yet"));
}


/* Bool hasFacet(Type type) */
Bool Type_hasFacet(Type* self, Type* type)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.hasFacet not implemented yet"));
}


/* Str? doc() */
Str* Type_doc(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.doc not implemented yet"));
}


/* Str toLocale() */
Str* Type_toLocale(Type* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Type.toLocale not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Type_initType(void)
{
  if (Type_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Type_initVTable();
    Type* type = Type_new("Type", baseType, vtable, sizeof(Type), sizeof(TypeVTable));
    Type_registerMethodImplementation(type, "base", Type_base, 0);
    Type_registerMethodImplementation(type, "doc", Type_doc, 0);
    Type_registerMethodImplementation(type, "emptyList", Type_emptyList, 0);
    Type_registerMethodImplementation(type, "facet", Type_facet_1, 1);
    Type_registerMethodImplementation(type, "facet", Type_facet, 2);
    Type_registerMethodImplementation(type, "facets", Type_facets, 0);
    Type_registerMethodImplementation(type, "field", Type_field_1, 1);
    Type_registerMethodImplementation(type, "field", Type_field, 2);
    Type_registerMethodImplementation(type, "fields", Type_fields, 0);
    Type_registerMethodImplementation(type, "find", Type_find_1, 1);
    Type_registerMethodImplementation(type, "find", Type_find, 2);
    Type_registerMethodImplementation(type, "fits", Type_fits, 1);
    Type_registerMethodImplementation(type, "hasFacet", Type_hasFacet, 1);
    Type_registerMethodImplementation(type, "inheritance", Type_inheritance, 0);
    Type_registerMethodImplementation(type, "isAbstract", Type_isAbstract, 0);
    Type_registerMethodImplementation(type, "isClass", Type_isClass, 0);
    Type_registerMethodImplementation(type, "isConst", Type_isConst, 0);
    Type_registerMethodImplementation(type, "isEnum", Type_isEnum, 0);
    Type_registerMethodImplementation(type, "isFacet", Type_isFacet, 0);
    Type_registerMethodImplementation(type, "isFinal", Type_isFinal, 0);
    Type_registerMethodImplementation(type, "isGeneric", Type_isGeneric, 0);
    Type_registerMethodImplementation(type, "isInternal", Type_isInternal, 0);
    Type_registerMethodImplementation(type, "isMixin", Type_isMixin, 0);
    Type_registerMethodImplementation(type, "isNullable", Type_isNullable, 0);
    Type_registerMethodImplementation(type, "isPublic", Type_isPublic, 0);
    Type_registerMethodImplementation(type, "isSynthetic", Type_isSynthetic, 0);
    Type_registerMethodImplementation(type, "isVal", Type_isVal, 0);
    Type_registerMethodImplementation(type, "make", Type_make_0, 0);
    Type_registerMethodImplementation(type, "make", Type_make, 1);
    Type_registerMethodImplementation(type, "method", Type_method_1, 1);
    Type_registerMethodImplementation(type, "method", Type_method, 2);
    Type_registerMethodImplementation(type, "methods", Type_methods, 0);
    Type_registerMethodImplementation(type, "mixins", Type_mixins, 0);
    Type_registerMethodImplementation(type, "name", Type_name, 0);
    Type_registerMethodImplementation(type, "of", Type_of, 1);
    Type_registerMethodImplementation(type, "parameterize", Type_parameterize, 1);
    Type_registerMethodImplementation(type, "params", Type_params, 0);
    Type_registerMethodImplementation(type, "pod", Type_pod, 0);
    Type_registerMethodImplementation(type, "qname", Type_qname, 0);
    Type_registerMethodImplementation(type, "signature", Type_signature, 0);
    Type_registerMethodImplementation(type, "slot", Type_slot_1, 1);
    Type_registerMethodImplementation(type, "slot", Type_slot, 2);
    Type_registerMethodImplementation(type, "slots", Type_slots, 0);
    Type_registerMethodImplementation(type, "toListOf", Type_toListOf, 0);
    Type_registerMethodImplementation(type, "toLocale", Type_toLocale, 0);
    Type_registerMethodImplementation(type, "toNonNullable", Type_toNonNullable, 0);
    Type_registerMethodImplementation(type, "toNullable", Type_toNullable, 0);
    Type_registerMethodImplementation(type, "toStr", Type_toStr, 0);
    Type_classType = type;
    Type_initStatic();
  }
  return Type_classType;
}


VTable* Type_initVTable(void)
{
  if (Type_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(TypeVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->toStr = Type_toStr;
    Type_classVTable = vtable;
  }
  return Type_classVTable;
}


void Type_initStatic(void)
{
}
